home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-11 | 1.8 KB | 79 lines | [TEXT/KAHL] |
- /********************************/
- /* File: GetFileName.c */
- /* */
- /* Using Standard File Package */
- /* query the user for the name */
- /* of a file to open, and return*/
- /* the name along with the */
- /* working directory id of the */
- /* file. */
- /* */
- /* Paramters: */
- /* paramCnt = number of types */
- /* params[0..3] = the types to */
- /* filter for (see Inside Mac. */
- /* I-523 for details */
- /* ---------------------------- */
- /* To Build: */
- /* */
- /* (1) Create a project using */
- /* this file as well as the */
- /* XCMD.Glue.c file. (Set */
- /* project type to XCMD (or */
- /* XFCN) from the Project menu. */
- /* */
- /* (2) Bring the project up to */
- /* date. */
- /* */
- /* (3) Build Code Resource. */
- /* */
- /* (4) Use ResEdit to copy the */
- /* resource to your stack. */
- /********************************/
-
- #include <MacTypes.h>
- #include <OSUtil.h>
- #include <MemoryMgr.h>
- #include <FileMgr.h>
- #include <ResourceMgr.h>
- #include <pascal.h>
- #include <strings.h>
- #include "HyperXCmd.h"
- #include "HyperUtils.h"
-
- pascal void main( paramPtr )
- XCmdBlockPtr paramPtr;
- {
- short FileWDID;
- short numTypes;
- short i;
- SFTypeList typs;
- char FileName[256];
- char WDIDString[32];
- char comma[2];
-
- if( !paramPtr->paramCount )
- numTypes = -1; /* select all since no type specified */
- else{
- numTypes = paramPtr->paramCount;
- for( i = 0; i < numTypes; i++ )
- BlockMove( *(paramPtr->params[i]), &typs[i], 4L );
- }
-
- *FileName = '\0';
-
- if( GetFileNameToOpen( typs, numTypes, FileName, &FileWDID ) ){
- NumToStr( paramPtr, (long)FileWDID, &WDIDString );
- PtoCstr( WDIDString );
-
- comma[0] = ','; /* for you MPW folk */
- comma[1] = '\0';
-
- strcat( FileName, comma );
- strcat( FileName, WDIDString );
- CtoPstr( FileName );
- }
- paramPtr->returnValue = PasToZero( paramPtr, FileName );
- }
-
-